import { PORT1 } from '@/api/config/servicePort'
import http from '@/api'

/**
 * @name 菜单管理模块
 */
// 获取菜单列表
export const getMenuListApi = (params) => {
  return http.get(PORT1 + `/SysMenu/MenuTreeList`,params)
}
//添加与修改已有菜单接口方法
export const reqAddOrUpdateMenuApi = (data, flag) => {
  //修改已有菜单的数据
  if (data.id > 0 && !flag) {
    return http.put(PORT1 + `/SysMenu/Update`, data)
  } else {
    //新增菜单
    return http.post(PORT1 + `/SysMenu/Add`, data)
  }
}

//删除某一个已有菜单的数据
export const reqDeleteMenuApi = (id: number) =>
  http.delete(PORT1 + `/SysMenu/Delete/` + id)
